<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>PopMenu test</title>
<link rel="stylesheet" type="text/css" href="../button/button.css" />
<link rel="stylesheet" type="text/css" href="../popbox/popbox.css" />
<link rel="stylesheet" type="text/css" href="../toolbar/toolbar.css" />
<link rel="stylesheet" type="text/css" href="popmenu.css" />
<link rel="stylesheet" type="text/css" href="test.css" />

<link rel="stylesheet" type="text/css" href="test.css" />
<script type="text/javascript" src="test.js"></script>

<script type="text/javascript" src="../../os3jslib/liwe.js"></script>
<script type="text/javascript" src="../../os3jslib/utils.js"></script>
<script type="text/javascript" src="../../os3jslib/dom.js"></script>
<script type="text/javascript" src="../../os3jslib/string_enh.js"></script>
<script type="text/javascript" src="../../os3jslib/object_enh.js"></script>
<script type="text/javascript" src="../wwl.js"></script>

<script type="text/javascript" src="../button/button.js"></script>
<script type="text/javascript" src="../popbox/popbox.js"></script>
<script type="text/javascript" src="../toolbar/toolbar.js"></script>
<script type="text/javascript" src="popmenu.js"></script>

<script type="text/javascript">
var test = {};

test.init = function ()
{
        var m = new WWL.popmenu ( 'prova' );

        m.add_item ( { txt: 'Primo', cback: test.add_primo, block_auto_close: true } );
        m.add_item ( { type: "split" } );
        m.add_item ( { txt: 'secondo', cback: test.add_secondo, tooltip: "Secondo elemento" } );
        m.add_item ( { txt: 'terzo', cback: test.add_terzo } );

        m.set_parent ( $( 'p1' ), 'D' );
}

test.add_primo = function ( widget, name, div )
{
	var m = new WWL.popmenu ( 'primo' );
	m.add_item ( { txt: 'primo1' } );
	m.add_item ( { txt: 'primo2' } );
	m.add_item ( { txt: 'primo3' } );

	m.box.set_parent ( div, 'R' );
	
	m.show ();
}

test.add_secondo = function ()
{

};

test.add_terzo = function ()
{

};


test.hide_show = function ( div )
{
        var m = WWL.popmenu.get_instance ( 'prova' );

        m.set_parent ( div );
        m.show_hide ();
};
</script>

</head>
<body onload="test.init()">
	<div id="p1" onclick="test.hide_show(this)">MENU</div>

</body>
</html>
